package model;

import java.util.Vector;

public class ResultSetWeb {
	
	private String count, start, totalhits, deephits;
	private Vector<Result> results;
	
	public String getCount() {
		return count;
	}

	public void setCount(String count) {
		this.count = count;
	}

	public String getStart() {
		return start;
	}

	public void setStart(String start) {
		this.start = start;
	}

	public String getTotalhits() {
		return totalhits;
	}

	public void setTotalhits(String totalhits) {
		this.totalhits = totalhits;
	}

	public String getDeephits() {
		return deephits;
	}

	public void setDeephits(String deepHits) {
		this.deephits = deepHits;
	}

	public ResultSetWeb() {
		super();
		this.results = new Vector<Result>();
	}

	public void addResult(Result r) {
		results.addElement(r);
	}

	@Override
	public String toString() {
		String result = "count: " + count + "\n" + 
		       "start: " + start + "\n" +
		       "totalhits: " + totalhits + "\n" +
		       "deephits: " + deephits + "\n";
		result += "\n";
//		for (int i=0; i<results.size(); i++)
//		  result += "id " + String.valueOf(i) + "\n" + results.get(i).toString() + "\n";
		
		return result;
	}

  public Vector<Doc> getResultsAsDocs() {
    Vector<Doc> result = new Vector<Doc>();
    for(int i=0; i<results.size(); i++) {
      result.add(new Doc(Integer.parseInt(start)+i, results.get(i)));
    }
    return result; 
  }
	
//  public void append(ResultSetWeb rsw) {
//    for (Result r : rsw.results) {
//      results.add(r);
//    }
//  }
	
}
